package com.fingard.dsp.bank.directbank.cgbunion01.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {

	public static String decodeXmlFromUnicode(String xmlMsg) {
		try {
			String reg = "&#x[0-9A-Z]{4};";
			Pattern pattern = Pattern.compile(reg);
			Matcher matcher = pattern.matcher(xmlMsg);
			while (matcher.find()) {
				String uniStr = matcher.group();
				String replace = uniStr.replaceAll("&#x", "").replaceAll(";",
						"");
				String result = (char) Integer.valueOf(replace, 16).intValue()
						+ "";
				xmlMsg = xmlMsg.replace(uniStr, result);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return xmlMsg;
	}
}